package istar.impl;

import istar.IElement;
import istar.IPosition;
import istar.IRole;

import java.util.Iterator;
import java.util.List;
import java.util.Vector;

public class Position extends Actor implements IPosition{

	private List<IRole> covers = new Vector<IRole>();
	
	public Position() {
		super();
	}

	public Position(String name) {
		super();
		this.setName(name);
	}

	@Override
	public List<IRole> getCovers() {
		return this.covers;
	}

	@Override
	public void setCovers(List<IRole> value) {
		this.covers = value;
	}

	@Override
	public boolean able(IElement elmnt) {
		Iterator<IRole> itRoles = covers.iterator();
		while (itRoles.hasNext()){
			IRole role = itRoles.next();
			if (role.able(elmnt))
				return true;
		}
		return false;
	}

	@Override
	public boolean workable(IElement elmnt) {
		Iterator<IRole> itRoles = covers.iterator();
		while (itRoles.hasNext()){
			IRole role = itRoles.next();
			if (role.workable(elmnt))
				return true;
		}
		return false;
	}
	
	
}
